/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.germinus.telcoblocks.provider;

import java.util.ArrayList;
import java.util.Collection;

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;

import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;

import org.germinus.telcoblocks.util.TelcoblocksAdapterFactory;

/**
 * This is the factory that is used to provide the interfaces needed to support Viewers.
 * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
 * The adapters also support Eclipse property sheets.
 * Note that most of the adapters are shared among multiple instances.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class TelcoblocksItemProviderAdapterFactory extends TelcoblocksAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
	/**
	 * This keeps track of the root adapter factory that delegates to this adapter factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ComposedAdapterFactory parentAdapterFactory;

	/**
	 * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IChangeNotifier changeNotifier = new ChangeNotifier();

	/**
	 * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Collection<Object> supportedTypes = new ArrayList<Object>();

	/**
	 * This constructs an instance.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TelcoblocksItemProviderAdapterFactory() {
		supportedTypes.add(IEditingDomainItemProvider.class);
		supportedTypes.add(IStructuredItemContentProvider.class);
		supportedTypes.add(ITreeItemContentProvider.class);
		supportedTypes.add(IItemLabelProvider.class);
		supportedTypes.add(IItemPropertySource.class);
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Enlace} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EnlaceItemProvider enlaceItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Enlace}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createEnlaceAdapter() {
		if (enlaceItemProvider == null) {
			enlaceItemProvider = new EnlaceItemProvider(this);
		}

		return enlaceItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.RED} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected REDItemProvider redItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.RED}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createREDAdapter() {
		if (redItemProvider == null) {
			redItemProvider = new REDItemProvider(this);
		}

		return redItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Telefono_VOIP} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Telefono_VOIPItemProvider telefono_VOIPItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Telefono_VOIP}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTelefono_VOIPAdapter() {
		if (telefono_VOIPItemProvider == null) {
			telefono_VOIPItemProvider = new Telefono_VOIPItemProvider(this);
		}

		return telefono_VOIPItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.SoftPhone_VOIP} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SoftPhone_VOIPItemProvider softPhone_VOIPItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.SoftPhone_VOIP}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSoftPhone_VOIPAdapter() {
		if (softPhone_VOIPItemProvider == null) {
			softPhone_VOIPItemProvider = new SoftPhone_VOIPItemProvider(this);
		}

		return softPhone_VOIPItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Servidor_APP_SIP} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Servidor_APP_SIPItemProvider servidor_APP_SIPItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Servidor_APP_SIP}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createServidor_APP_SIPAdapter() {
		if (servidor_APP_SIPItemProvider == null) {
			servidor_APP_SIPItemProvider = new Servidor_APP_SIPItemProvider(this);
		}

		return servidor_APP_SIPItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Servidor_VOIP} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Servidor_VOIPItemProvider servidor_VOIPItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Servidor_VOIP}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createServidor_VOIPAdapter() {
		if (servidor_VOIPItemProvider == null) {
			servidor_VOIPItemProvider = new Servidor_VOIPItemProvider(this);
		}

		return servidor_VOIPItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Centralita_VOIP} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected Centralita_VOIPItemProvider centralita_VOIPItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Centralita_VOIP}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createCentralita_VOIPAdapter() {
		if (centralita_VOIPItemProvider == null) {
			centralita_VOIPItemProvider = new Centralita_VOIPItemProvider(this);
		}

		return centralita_VOIPItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.MediaServer} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MediaServerItemProvider mediaServerItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.MediaServer}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createMediaServerAdapter() {
		if (mediaServerItemProvider == null) {
			mediaServerItemProvider = new MediaServerItemProvider(this);
		}

		return mediaServerItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.SERVICIOS} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SERVICIOSItemProvider serviciosItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.SERVICIOS}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createSERVICIOSAdapter() {
		if (serviciosItemProvider == null) {
			serviciosItemProvider = new SERVICIOSItemProvider(this);
		}

		return serviciosItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.IM} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected IMItemProvider imItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.IM}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createIMAdapter() {
		if (imItemProvider == null) {
			imItemProvider = new IMItemProvider(this);
		}

		return imItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Telefono} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TelefonoItemProvider telefonoItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Telefono}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createTelefonoAdapter() {
		if (telefonoItemProvider == null) {
			telefonoItemProvider = new TelefonoItemProvider(this);
		}

		return telefonoItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Web} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected WebItemProvider webItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Web}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createWebAdapter() {
		if (webItemProvider == null) {
			webItemProvider = new WebItemProvider(this);
		}

		return webItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.ServicioGen} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ServicioGenItemProvider servicioGenItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.ServicioGen}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createServicioGenAdapter() {
		if (servicioGenItemProvider == null) {
			servicioGenItemProvider = new ServicioGenItemProvider(this);
		}

		return servicioGenItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Llamadas} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LlamadasItemProvider llamadasItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Llamadas}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createLlamadasAdapter() {
		if (llamadasItemProvider == null) {
			llamadasItemProvider = new LlamadasItemProvider(this);
		}

		return llamadasItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.ClickToDial} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ClickToDialItemProvider clickToDialItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.ClickToDial}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createClickToDialAdapter() {
		if (clickToDialItemProvider == null) {
			clickToDialItemProvider = new ClickToDialItemProvider(this);
		}

		return clickToDialItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Personalizacion} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PersonalizacionItemProvider personalizacionItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Personalizacion}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createPersonalizacionAdapter() {
		if (personalizacionItemProvider == null) {
			personalizacionItemProvider = new PersonalizacionItemProvider(this);
		}

		return personalizacionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Facturacion} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FacturacionItemProvider facturacionItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Facturacion}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createFacturacionAdapter() {
		if (facturacionItemProvider == null) {
			facturacionItemProvider = new FacturacionItemProvider(this);
		}

		return facturacionItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Anuncios} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AnunciosItemProvider anunciosItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Anuncios}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createAnunciosAdapter() {
		if (anunciosItemProvider == null) {
			anunciosItemProvider = new AnunciosItemProvider(this);
		}

		return anunciosItemProvider;
	}

	/**
	 * This keeps track of the one adapter used for all {@link org.germinus.telcoblocks.Desvio} instances.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DesvioItemProvider desvioItemProvider;

	/**
	 * This creates an adapter for a {@link org.germinus.telcoblocks.Desvio}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter createDesvioAdapter() {
		if (desvioItemProvider == null) {
			desvioItemProvider = new DesvioItemProvider(this);
		}

		return desvioItemProvider;
	}

	/**
	 * This returns the root adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComposeableAdapterFactory getRootAdapterFactory() {
		return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
	}

	/**
	 * This sets the composed adapter factory that contains this factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
		this.parentAdapterFactory = parentAdapterFactory;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean isFactoryForType(Object type) {
		return supportedTypes.contains(type) || super.isFactoryForType(type);
	}

	/**
	 * This implementation substitutes the factory itself as the key for the adapter.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Adapter adapt(Notifier notifier, Object type) {
		return super.adapt(notifier, this);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object adapt(Object object, Object type) {
		if (isFactoryForType(type)) {
			Object adapter = super.adapt(object, type);
			if (!(type instanceof Class) || (((Class<?>)type).isInstance(adapter))) {
				return adapter;
			}
		}

		return null;
	}

	/**
	 * This adds a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void addListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.addListener(notifyChangedListener);
	}

	/**
	 * This removes a listener.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void removeListener(INotifyChangedListener notifyChangedListener) {
		changeNotifier.removeListener(notifyChangedListener);
	}

	/**
	 * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void fireNotifyChanged(Notification notification) {
		changeNotifier.fireNotifyChanged(notification);

		if (parentAdapterFactory != null) {
			parentAdapterFactory.fireNotifyChanged(notification);
		}
	}

	/**
	 * This disposes all of the item providers created by this factory. 
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void dispose() {
		if (enlaceItemProvider != null) enlaceItemProvider.dispose();
		if (redItemProvider != null) redItemProvider.dispose();
		if (telefono_VOIPItemProvider != null) telefono_VOIPItemProvider.dispose();
		if (softPhone_VOIPItemProvider != null) softPhone_VOIPItemProvider.dispose();
		if (servidor_APP_SIPItemProvider != null) servidor_APP_SIPItemProvider.dispose();
		if (servidor_VOIPItemProvider != null) servidor_VOIPItemProvider.dispose();
		if (centralita_VOIPItemProvider != null) centralita_VOIPItemProvider.dispose();
		if (mediaServerItemProvider != null) mediaServerItemProvider.dispose();
		if (serviciosItemProvider != null) serviciosItemProvider.dispose();
		if (imItemProvider != null) imItemProvider.dispose();
		if (telefonoItemProvider != null) telefonoItemProvider.dispose();
		if (webItemProvider != null) webItemProvider.dispose();
		if (servicioGenItemProvider != null) servicioGenItemProvider.dispose();
		if (llamadasItemProvider != null) llamadasItemProvider.dispose();
		if (clickToDialItemProvider != null) clickToDialItemProvider.dispose();
		if (personalizacionItemProvider != null) personalizacionItemProvider.dispose();
		if (facturacionItemProvider != null) facturacionItemProvider.dispose();
		if (anunciosItemProvider != null) anunciosItemProvider.dispose();
		if (desvioItemProvider != null) desvioItemProvider.dispose();
	}

}
